home *** CD-ROM | disk | FTP | other *** search
- /////////////////////////////////////////////////////////////////////////////// //
- // $Id: DeviceRegistry.cxx,v 1.1 1994/02/18 20:11:53 bmott Exp $
- /////////////////////////////////////////////////////////////////////////////// //
- // DeviceRegistry.cxx
- //
- // This class keeps up with a list of all of the availible devices and
- // allocates them. It's derived from the BasicDeviceRegistry
- //
- // Sim68000 "Motorola 68000 Simulator"
- // Copyright (c) 1993
- // By: Bradford W. Mott
- // October 30,1993
- //
- ///////////////////////////////////////////////////////////////////////////////
- // $Log: DeviceRegistry.cxx,v $
- // Revision 1.1 1994/02/18 20:11:53 bmott
- // Initial revision
- //
- ///////////////////////////////////////////////////////////////////////////////
-
- #include <iostream.h>
- #include "DeviceRegistry.hxx"
- #include "RAM.hxx"
- #include "M68681.hxx"
-
- ///////////////////////////////////////////////////////////////////////////////
- // Array of device information (name, description, tcl script)
- ///////////////////////////////////////////////////////////////////////////////
- const DeviceInformation DeviceRegistry::device_info[] = {
- {"RAM",
- "Random Access Memory",
- #include "RAM.scr"
- },
- {"M68681",
- "Motorola 68681 Dual UART",
- #include "M68681.scr"
- }
- };
-
- ///////////////////////////////////////////////////////////////////////////////
- // The Constructor
- ///////////////////////////////////////////////////////////////////////////////
- DeviceRegistry::DeviceRegistry()
- : BasicDeviceRegistry(device_info,
- sizeof(device_info)/sizeof(DeviceInformation))
- {}
-
- ///////////////////////////////////////////////////////////////////////////////
- // Create a device with the given name (return 1=OK,0=ERROR)
- ///////////////////////////////////////////////////////////////////////////////
- int DeviceRegistry::Create(String& name, String& args, BasicCPU *cpu,
- BasicDevice* &device)
- {
- if (name=="RAM")
- device=new RAM(args, cpu);
- else if (name=="M68681")
- device=new M68681(args, cpu);
- else
- return(0);
-
- // If the device's error message is not empty then return error
- if(device->GetErrorMessage()!="")
- {
- delete device;
- return(0);
- }
-
- return(1);
- }
-
-